# Maintainer: Alexander Epaneshnikov <alex19ep@archlinux.org>
# Contributor: Moritz Bunkus <moritz@bunkus.org>

pkgname=perl-xs-parse-keyword
pkgver=0.38
pkgrel=3
pkgdesc="XS functions to assist in parsing keyword syntax"
arch=('loong64' 'x86_64')
url="https://metacpan.org/dist/XS-Parse-Keyword"
license=('PerlArtistic' 'GPL')
depends=('perl')
makedepends=('perl-extutils-cchecker>=0.11' 'perl-module-build>=0.4004')
checkdepends=('perl-test2-suite')
source=("https://cpan.metacpan.org/authors/id/P/PE/PEVANS/XS-Parse-Keyword-${pkgver}.tar.gz")
sha512sums=('2b7dfade590c00095681a55ff937e3d9de1f939e0ea9fec6ae5cd06e618c2dacdc226f94047d41e6d95725dbf722feb3f2c8794a9a6950bfe12fc53bdbb823fa')

build() {
  cd "XS-Parse-Keyword-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1 MODULEBUILDRC=/dev/null
  /usr/bin/perl Build.PL
  ./Build
}

check() {
  cd "XS-Parse-Keyword-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  export PERL_MM_USE_DEFAULT=1
  ./Build test
}

package() {
  cd "XS-Parse-Keyword-${pkgver}"
  unset PERL5LIB PERL_MM_OPT PERL_MB_OPT PERL_LOCAL_LIB_ROOT
  ./Build install --installdirs=vendor --destdir="$pkgdir"
  find "$pkgdir" "(" -name .packlist -o -name perllocal.pod ")" -delete
}
